package com.aaa.controller;

import com.aaa.entity.MyReturn;
import com.aaa.entity.Tester;
import com.aaa.service.TesterFPAService;
import com.aaa.service.TesterSASService;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("testerSAS")
public class TesterSASController extends BaseController{
    MyReturn myReturn=new MyReturn();


    @Autowired
    private TesterSASService testerSASService;
    @RequestMapping("selectTester.do")
    @ResponseBody
    public MyReturn selectTester(Tester tester){
       Page page= testerSASService.selectTester(tester);
        if (page.getResult()!=null&&page.getResult().size()>0){
            myReturn.setData(page.getResult());
            myReturn.setCount(page.getTotal());
            return  super.getSuccessReturn(myReturn);
        }
        return  super.getFailReturn(myReturn);
    }
    @RequestMapping("deleteTesterById.do")
    @ResponseBody
    public MyReturn deleteTesterById(Integer id){
        boolean deleteTesterById = testerSASService.deleteTesterById(id);
        if (deleteTesterById){
            return  super.getSuccessReturn(myReturn);
        }
        return super.getFailReturn(myReturn);
    }
    @RequestMapping("deleteTesterBatch.do")
    @ResponseBody
    public MyReturn deleteTesterById(String id){
        boolean deleteTesterById = testerSASService.deleteTesterBatch(id);
        if (deleteTesterById){
            return  super.getSuccessReturn(myReturn);
        }
        return super.getFailReturn(myReturn);
    }

}
